<?php

class Zend_View_Helper_AddThis extends Zend_View_Helper_Abstract {

	public function addThis($title, $pubid = '', $via = '') {
		$url = 'http://' . $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
		
		if (is_array($title))
			$title = implode(' - ', $title);
		
		return '<div id="addthis_toolbox">
			<div addthis:url="' . $url . '" addthis:title="' . $title . '" class="addthis_toolbox addthis_default_style">
				<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
				<a class="addthis_button_google_plusone" g:plusone:size="small" rel="nofollow"></a>
				<a class="addthis_button_facebook"></a>
				<a class="addthis_button_twitter" tw:via="' . $via . '"></a>
				<a class="addthis_button_email"></a>
			</div>
			<script type="text/javascript">
			var addthis_config = {
				pubid: "' . $pubid . '",
				ui_language: "pt-BR",
				data_track_clickback: true
			};
			var addthis_share = {
				email_template: "default",
				templates: {
					twitter: "{{title}}: {{url}} via @' . $via . '"
				}
			};
			</script>
		</div>';
	}
}